* -------------------------------------------------------
* Date : Feb 26, 2020
* By Byungkyu Lee (bl11@indiana.edu)
* this code analyze processed data 
* please include tess_cleaned.dta file in the processed path
* -------------------------------------------------------

clear all 
set more off
set maxvar 10000

global home "/Users/BK/Dropbox/project/PI-bearman/dataverse"

global dir_raw "${home}/data/raw"
global dir_processed "${home}/data/processed"

cd "${home}/results"

use "${dir_processed}/tess_cleaned.dta", replace 

* Table X. Mean Comparison across different conditions in TESS 2016.
* -- first drop non-nationally representative data in 2016
drop if missing(weight) & year == 2016

* from here, one can execute one file at a time
* Table 1
do "${home}/code/PI_models_trends_relationship_type.do"
* Figure 1 + Table S1 
do "${home}/code/PI_models_trends_network_size.do"
* also see PI_figure_trends_networksize.R

* zipcode level analysis
* run PI_process_text_zip.R to produce `tess_zip_text.dta` and `tess2016_multiple_choice_zip.dta` files
do "${home}/code/PI_models_zipcode_text.do"

* Table S3 + Figure 4 + Figure 5
do "${home}/code/PI_models_dyad_logit.do"

* Table 2 + Figure 6
do "${home}/code/PI_models_prediction_multilevel.do"
* also see PI_figure_prediction.R

* Table 4 + Table 5 + Table A4
do "${home}/code/PI_models_treatment_effects_tess2016.do"






